import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login' // 登录页 自动找index页面
import Layout from '@/views/Layout'
import Home from '@/views/Home'

// const Home = () => import(/* webpackChunkName: "Home" */ '@/views/Home')
const My = () => import(/* webpackChunkName: "My" */ '@/views/My')
// import My from '../views/My'
const Search = () => import(/* webpackChunkName: "Search" */ '@/views/Search')
// import Search from '../views/Search'
const readArtcle = () => import(/* webpackChunkName: "readArtcle" */ '@/views/readArtcle')
// import readArtcle from '../views/readArtcle'
const Add = () => import(/* webpackChunkName: "Add" */ '@/views/addchanael')
// import Add from '../views/addchanael'
const Edid = () => import(/* webpackChunkName: "Edid" */ '@/views/My/EditData')
// import Edid from '../views/My/EditData'
const SearchList = () => import(/* webpackChunkName: "SearchList" */ '@/views/Search/ResuitList.vue')
// import SearchList from '../views/Search/ResuitList.vue'
const Chat = () => import(/* webpackChunkName: "Chat" */ '@/views/Chat')
// import Chat from '../views/Chat'
Vue.use(VueRouter)
const routes = [
  {
    path: '/',
    redirect: '/Login'
  },

  {
    path: '/Login',
    component: Login
  },
  {
    path: '/layout',
    component: Layout,
    // 重定向
    redirect: '/layout/home',
    children: [
      {
        path: 'home',
        component: Home,
        meta: {
          scrollY: 0
        }
      },
      {
        path: 'my',
        component: My
      }]
  },
  {
    path: '/search',
    component: Search
  }, {
    path: '/readArtcle/:id',
    name: 'reda',
    component: readArtcle
  },
  {
    path: '/add',
    component: Add
  },
  {
    path: '/edit',
    component: Edid
  },
  {
    path: '/search/:id',
    name: 'result',
    component: SearchList
  },
  //同学
  {
    path: '/chat',
    component: Chat
  }
]

const router = new VueRouter({
  routes
})

export default router
